本地环境参数
| 参数 | 说明 |
|---|---|
OS |
windows10 |
Terminal |
gitbash |
线上机OS |
centos7.6 |
线上环境参数
| 参数 | 说明 |
|---|---|
OS |
centos7.6 |
git |
这个是必备的 |
zsh |
已安装zsh,并sudo chsh -s /bin/zsh <username> 默认为登录sh |
1 安装
curl
1
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
wget
1
sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
2 配置
2.1 主题
安装字体SauceCodePro Nerd Font Mono。windowns系统直接下载复制到c://windows/fonts下.在本地.~/.minttyrc 文件加入 Font=SauceCodePro Nerd Font Mono 用于指定默认这个字体.
回到线上机, 在~/.zshrc 修改参数ZSH_THEME="agnoster",这里指定的主题为agnoster , 这是仓库.
然后输入source ~/.zshrc重新加载配置, 使用主题生效
2.2 插件
2.2.1 安装命令自动提示插件
下载`git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
插件下来后,在~/.zshrc的plugins加入zsh-autosuggestions:
1 | plugins=(git ....... zsh-autosuggestions) |
注:如果命令提示颜色没有明暗区分,就在~/.zshrc加入
1 | TERM=xterm-256color VIEWS=168374 |
更多资料去官方文档看吧.
2.2.2 命令行高亮
还是跟上面的一样,先把插件复制下来git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
然后在~/.zshrc 的plugin里加入zsh-syntax-highlighting
1 | plugins=( git ... zsh-syntax-highlighting) |
最后重载下配置source ~/.zshrc。
来源:
- 1.githubhttps://github.com/robbyrussell/oh-my-zsh
- 2.官方网站http://ohmyz.sh/